#!/bin/bash
#centos76 init  + docker-ce ntp 
#yum update -y
#yum install wget -y
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo http://192.168.50.211/repos/base.repos
curl -o /etc/yum.repos.d/epel.repo http://192.168.50.211/repos/epel.repos
curl -o /etc/yum.repos.d/elrepo.repo http://192.168.50.211/repos/elrepo.repos
yum clean all
yum makecache
yum update -y
yum install telnet net-tools  epel-release container-selinux -y
sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2
#sudo yum-config-manager \
#  --add-repo \
#  https://download.docker.com/linux/centos/docker-ce.repo
curl -o /etc/yum.repos.d/docker-ce.repo http://192.168.50.211/repos/docker-ce.repos
sudo yum install -y docker-ce-18.09.9-3.el7 docker-ce-cli-18.09.9-3.el7 containerd.io
sudo systemctl enable docker.service
mkdir -p /data/docker/data-root
mkdir -p /etc/docker
cat > /etc/docker/daemon.json <<EOF
{
  "data-root": "/data/docker/data-root",
  "registry-mirrors" : [
    "https://6zy5kcio.mirror.aliyuncs.com"
  ]
}
EOF
systemctl enable docker && systemctl restart docker

cat > /etc/sysctl.d/k8s.conf << EOF
net.ipv4.ip_forward=1
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1
vm.swappiness=0
vm.max_map_count=655360 
EOF

sysctl -p /etc/sysctl.d/k8s.conf
